package com.tuanzi.loan.schedule.receipt.monitor.sender;

import com.tuanzi.loan.schedule.receipt.monitor.ISender;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class DingDingSender implements ISender {

    private final DingTalkService dingTalkService;
    private final String url;
    private final String content;

    public DingDingSender(DingTalkService dingTalkService, String url, String content) {
        this.dingTalkService = dingTalkService;
        this.url = url;
        this.content = content;
    }

    @Override
    public void send() {
        try {
            dingTalkService.sendMessage(url, content);
        } catch (Exception e) {
            log.error("Send dingding occur error.", e);
        }
    }
}
